From ef2e7454cae8dab485ec4cbce85134a7b7bd7ecd Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Date: Wed, 14 May 2014 14:58:27 +0400
Subject: [PATCH] improve pkgconfig module (close #37)

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
---
 Makefile.in       |  4 ++++
 configure.ac      |  4 +++-
 json-parser.pc.in | 10 ++++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 json-parser.pc.in

diff --git a/Makefile.in b/Makefile.in
index 85e9e38..68e0b33 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -4,6 +4,7 @@ prefix = @prefix@
 
 includedir = $(DESTDIR)@includedir@
 libdir = $(DESTDIR)@libdir@
+datadir = $(DESTDIR)@datadir@
 
 AR = @AR@
 CC = @CC@
@@ -40,6 +41,9 @@ clean:
 	rm -f libjsonparser.$(SO_EXT) libjsonparser.a json.o
 
 install-shared: libjsonparser.$(SO_EXT)
+	@echo Installing pkgconfig module: $(datadir)/pkgconfig/json-parser.pc
+	@install -d $(datadir)/pkgconfig/ || true
+	@install -m 0644 json-parser.pc $(datadir)/pkgconfig/json-parser.pc
 	@echo Installing shared library: $(libdir)/libjsonparser.$(SO_EXT)
 	@install -d $(libdir) || true
 	@install -m 0755 libjsonparser.$(SO_EXT) $(libdir)/$(REAL_NAME)
diff --git a/configure.ac b/configure.ac
index 8e73fc3..2111634 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,9 @@ fi
 
 AC_SUBST(VERSION_MAJOR, $VERSION_MAJOR)
 
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([
+                 Makefile
+                 json-parser.pc])
 
 AC_OUTPUT
 
diff --git a/json-parser.pc.in b/json-parser.pc.in
new file mode 100644
index 0000000..fc743c4
--- /dev/null
+++ b/json-parser.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: json-parser
+Description: Very low footprint JSON parser written in portable ANSI C
+Version: @VERSION_MAJOR@
+Libs: -L${libdir} -ljsonparser
+Cflags: -I${includedir}/json-parser
